from djangoDrf.serializers import DynamicFieldsModelSerializer
from task.models import TaskUser
from user.models import User, Role, Clazz


class UserSerializer(DynamicFieldsModelSerializer):

    class Meta:
        model = User
        exclude = ['groups', 'user_permissions']


    def create(self, validated_data):
        return User.objects.create_user(**validated_data)


class RoleSerializer(DynamicFieldsModelSerializer):
    class Meta:
        model = Role
        fields = '__all__'


class ClazzSerializer(DynamicFieldsModelSerializer):
    class Meta:
        model = Clazz
        fields = '__all__'
